package com.gzk.hrm.annotation;

import com.gzk.hrm.util.ValidatorUtils;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * 电话注解规则设置
 * @author jake.chen
 */
public class _TelValid implements ConstraintValidator<TelValid,String> {
    @Override
    public void initialize(TelValid constraintAnnotation) {}

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        if(null == value) {
            return false;
        }
        if(value.matches(ValidatorUtils.REGEX_MOBILE)) {
            return true;
        }
        return false;
    }

}